﻿namespace Zipper.Applications

module List =

    open Zipper.Zipper

    let private moveRight l =
        match l with
            | [] -> None
            | (x::xs) ->
                let crumb = { new breadcrumb<_> with member c.Reconstruct(ys) = x :: ys }
                Some (xs, crumb)

    /// Tries to move right.
    let tryRight z = tryDown moveRight z

    /// Moves right.
    let right z = down moveRight z

    /// Tries to move left.
    let tryLeft = tryUp

    /// Moves left.
    let left = up